<template>
  <div class="all-ops">
    <!-- <h1 class="personal-op">个性化选项</h1>
    <div class="ops-list-container">
      <ul class="ops-list">
        <li>
          <div class="light-switch" @click="lightSwitch($event)"></div>
          <div>模式切换</div>
        </li>
        <li></li>
      </ul>
    </div> -->
  </div>
</template>

<script>

import {MessageBox} from "mint-ui";
import * as url from "url";
export default {
  name: "AllOptions",
  data() {
    return {
      isLighted: true,
      switchMutexLock: false
    }
  },
  components: {

  },
  methods: {
    lightSwitch(e) {
      if (!this.switchMutexLock) {
        this.switchMutexLock = true
        this.isLighted = !this.isLighted
        let body = document.getElementsByTagName('body')[0]

        if (this.isLighted)
          body.style.color = '#2c3e50', body.style.backgroundColor = '#fff', e.currentTarget.style.backgroundColor = "#888888"
        else
          body.style.color = '#acb', body.style.backgroundColor = '#000', e.currentTarget.style.backgroundColor = "#fff"

        let timeId = setTimeout(() => {
          this.switchMutexLock = false
          clearTimeout(timeId)
        }, 500)
      } else {
        MessageBox('提示', '操作过于频繁')
      }
    }
  }
}
</script>

<style scoped>
  .personal-op{
    text-align: left;
    margin: 1rem;
    overflow: hidden;
  }
  ul.ops-list{
    width: 100%;
    height: 6rem;
    /*background-color: #ff8800;*/
    display: flex;
    justify-content: flex-start;
    overflow: hidden;
  }
  li{
    list-style: none;
    /*vertical-align: middle;*/
  }
  li>div:first-child{
    width: 4rem;
    height: 4rem;
    min-width: 4rem;
    min-height: 4rem;
    margin: 0 0.5rem 0 0.5rem;
    border: #e3e3e3 1px solid;
    border-radius: 4rem;
  }
  .light-switch{
    background: #888888 url("../../assets/imgs/icons/lighted.png") center center no-repeat;
    background-size: 3rem 3rem;
  }
</style>